package leetcode_1901_2000;

import java.util.Arrays;
import java.util.Comparator;
import java.util.PriorityQueue;

public class LeeCode_1953 {
    public static void main(String[] args) {
//        System.out.println(numberOfWeeks(new int[]{1, 2, 3}));

    }
    private static long numberOfWeeks(int[] milestones) {
        int n = milestones.length;
        Arrays.sort(milestones);
        long max = milestones[n - 1], sum = 0;
        for (int milestone : milestones) {
            sum += milestone;
        }
        if (sum - max < max){
            return (sum - max) * 2 + 1;
        }
        return sum;
    }
}
